/*
 * jxSwing Project (2014)
 * 
 * by Denilson Edinaldo Pinto
 * 
 * LGPL
 * Copyright (C) 2014
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.jxSwing.component.dialog;

import java.awt.Component;
import java.awt.Dimension;

import javax.swing.JOptionPane;

import org.jxSwing.component.panel.ExceptionPanel;
import org.jxSwing.i18n.I18N;

/**
 * @author Denilson Edinaldo Pinto
 * @porject jxSwing
 * @package org.jxSwing.component.dialog
 * @date 07/11/2014 - 20:34:13
 */
public final class ExceptionDialog {
	
	/**
	 * @param title
	 * @param throwable
	 */
	public static void showMessage(String title, Throwable throwable) {
	
		showMessage(title, throwable, null);
	}
	
	/**
	 * @param title
	 * @param throwable
	 * @param parentComponent
	 */
	public static void showMessage(String title, Throwable throwable, Component parentComponent) {
	
		showMessage(title, throwable, parentComponent, 500, 300);
	}
	
	/**
	 * @param title
	 * @param throwable
	 * @param parentComponent
	 * @param size
	 */
	public static void showMessage(String title, Throwable throwable, Component parentComponent, Dimension size) {
	
		JOptionPane.showMessageDialog(parentComponent, new ExceptionPanel(throwable, size), title, JOptionPane.ERROR_MESSAGE);
	}
	
	/**
	 * @param title
	 * @param throwable
	 * @param parentComponent
	 * @param width
	 * @param height
	 */
	public static void showMessage(String title, Throwable throwable, Component parentComponent, int width, int height) {
	
		showMessage(title, throwable, parentComponent, new Dimension(width, height));
	}
	
	/**
	 * @param throwable
	 */
	public static void showMessage(Throwable throwable) {
	
		showMessage(I18N.component().error(), throwable);
	}
	
	/**
	 * @param throwable
	 * @param parentComponent
	 */
	public static void showMessage(Throwable throwable, Component parentComponent) {
	
		showMessage(I18N.component().error(), throwable, parentComponent);
	}
	
	/**
	 * @param throwable
	 * @param parentComponent
	 * @param size
	 */
	public static void showMessage(Throwable throwable, Component parentComponent, Dimension size) {
	
		showMessage(I18N.component().error(), throwable, parentComponent, size);
	}
	
	/**
	 * @param throwable
	 * @param parentComponent
	 * @param width
	 * @param height
	 */
	public static void showMessage(Throwable throwable, Component parentComponent, int width, int height) {
	
		showMessage(I18N.component().error(), throwable, parentComponent, width, height);
	}
}
